package cn.kgc.springcloud.commons;

import lombok.Data;

/**
 * @author 课工场
 * @date 2024/5/8
 * @description
 */
@Data
public class ResponseResult {

    private Integer code;
    private String message;
    private  Object data;

    public static ResponseResult   success(){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setCode(0);
        responseResult.setMessage("操作成功");
        return  responseResult;
    }

    public static ResponseResult   fail(){
        ResponseResult responseResult = new ResponseResult();
        responseResult.setCode(110);
        responseResult.setMessage("操作失败");
        return  responseResult;
    }


    public ResponseResult code(Integer code){
        this.code = code;
        return this;
    }

    public ResponseResult message(String message){
        this.message = message;
        return this;
    }

    public ResponseResult data(Object data){
        this.data = data;
        return this;
    }
}
